<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      // find方法 查找第一个符合条件的数组成员，如果没有则返回undefined
      var ary = [
        {
          id: 1,
          name: "张三",
        },
        {
          id: 2,
          name: "李四",
        },
      ];
      let target = ary.find((item) => item.id == 2);
      console.log(target);

      //   findIndex()找出符合条件的数组成员的位置，如果没有找到则返回-1

      let ary1 = [1, 4, 7, 8, 10, 18];
      let index = ary1.findIndex((value, index) => value > 9);
      console.log(index);

      //   includes()表示某个数组是否包含给定的值，返回布尔值

      let result = ary1.includes(20);
      console.log(result);
    </script>
  </head>
  <body></body>
</html>
